<!DOCTYPE html>
<html>



<head>
    <!-- 和昌光谷未来成 积分商城H5后台 -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>矩阵互动</title>

    <link rel="shortcut icon" href="favicon.ico">
    <link href="css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">

    <link href="css/animate.min.css" rel="stylesheet">
    <link href="css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <style>
        .headimgUrl {
            width: 50px;
            height: 50px;
        }

        .serchInput {
            float: right;
            width: 200px;
            padding: 7px;
            border: 1px solid #958787;
            border-radius: 6px;
            margin-right: 20px;
            height: 44px;
            margin-top: 5px;
            margin-bottom: 5px;
            font-size: 18px;
        }

        .serchBtn {
            float: right;
            margin-right: 20px;
            width: 129px;
            font-size: 21px;
            margin-top: 5px;
            margin-bottom: 5px;
            font-weight: 600;
        }
    </style>
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>
        if (window.top !== window.self) { window.top.location = window.location; }
    </script>
</head>

<body class="gray-bg">

    <div id="login" class="middle-box text-center loginscreen  animated fadeInDown" style="margin-top:200px;">
        <div>

            <h3>欢迎使用</h3>

            <form class="m-t" role="form">
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="用户名" required="" id="loginUser">
                </div>
                <div class="form-group">
                    <input type="password" class="form-control" placeholder="密码" required="" id="loginPasswd">
                </div>
                <button type="button" class="btn btn-primary block full-width m-b" id="loginBtn">登 录</button>

            </form>
        </div>
    </div>

    <div id="table" class="row" style="display:none;">
        <button type="button" class="btn btn-primary block full-width m-b" id="openBtn">开启活动</button>
        <button type="button" class="btn btn-primary block full-width m-b" id="closeBtn">关闭活动</button>
    </div>


    <script src="js/jquery.min.js?v=2.1.4"></script>
    <script src="js/bootstrap.min.js?v=3.3.6"></script>
    <script>

        var remoteUrl = 'http://api.juzhen05.com/api';
        // var remoteUrl = 'http://localhost:61337/api';

        function fecthLogin(account, password, cb) {
            $.post(remoteUrl + '/checkin_hcgg_1109', { cmd: 11, account: account, password: password }, function (data) {
                if (cb) cb(data);
            })
        }

        var openActive = function () {
            $.post(remoteUrl + '/checkin_hcgg_1109', { cmd: 10, token: localStorage.getItem('local_token'), setState: "open" }, function (date) {
                alert(date.msg);
            })
        }

        var closeActive = function () {
            $.post(remoteUrl + '/checkin_hcgg_1109', { cmd: 10, token: localStorage.getItem('local_token'), setState: "close" }, function (date) {

                alert(date.msg);
            })
        }

        // 登陆
        $('#loginBtn').click(function () {
            fecthLogin($('#loginUser').val(), $('#loginPasswd').val(), function (data) {
                if (data.code) {
                    localStorage.setItem('local_token', data.token)
                    $('#login').hide();
                    $('#table').show();
                    // 获取表格数据

                } else {
                    alert(data.msg);
                }

            });
        })

        $('#openBtn').click(function () {
            openActive();
        })
        $('#closeBtn').click(function () {
            closeActive();
        })

    </script>

</body>

</html>